//
//  UIColor+HPieChart.swift
//  Drop
//
//  Created by hushaohua on 2018/4/6.
//  Copyright © 2018年 init. All rights reserved.
//

import UIKit

extension UIColor{
    
    static let pieRGBs:[[Int]] = [
                                  [0xfe, 0xff, 0x36],
                                  [0xf9, 0xbd, 0x0c],
                                  [0xf9, 0x99, 0x0b],
                                  [0xfb, 0x4b, 0x0e],
                                  [0xfb, 0x01, 0x15],
                                  [0xa5, 0x00, 0x4b],
                                  [0x84, 0x00, 0xaf],
                                  [0x01, 0xee, 0x2d],
                                  [0x69, 0xb4, 0x33],
                                  [0x15, 0x91, 0xce],
                                  [0x02, 0x32, 0xfe],
                                  [0x3c, 0x00, 0xa4]
                                  ];
    
    static func pieChartColors(_ count:Int) -> [UIColor]{
        var index:Int = 0;
        var colors:[UIColor] = [UIColor]();
        while index < count {
            let rgb:[Int] = pieRGBs[(index % 12)];
            colors.append(UIColor.rgbColor(rgb[0], rgb[1], rgb[2]));
            index = index + 1;
        }
        return colors;
    }
}
